package cz.fimuni.pa165.backendderby.services;

import cz.fimuni.pa165.backendderby.dao.ReservationDAO;
import cz.fimuni.pa165.backendderby.entities.Employee;
import cz.fimuni.pa165.backendderby.entities.Reservation;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 *
 * @author Andrej Hraško
 */
@Service
public class ReservationServiceImpl implements ReservationService {

    @Autowired
    private ReservationDAO reservationDAO;

    public void setReservationDAO(ReservationDAO reservationDAO) {
        this.reservationDAO = reservationDAO;
    }

    @Transactional
    public void create(Reservation reservation) throws IllegalArgumentException{

        reservationDAO.create(reservation);

    }

    @Transactional
    public void remove(Reservation reservation) {

        reservationDAO.remove(reservation);

    }

    @Transactional
    public List<Reservation> get(Employee employee) {

        return reservationDAO.get(employee);

    }

    @Transactional
    public Reservation getByID(Long id) {

        return reservationDAO.getByID(id);

    }
    
    @Transactional
    public List<Reservation> getAllReservations(){
        return reservationDAO.getAllReservations();
    }
}
